﻿//************************************************************************************************
// Copyright © 2003-2012 Steven M. Cohn. All Rights Reserved.
//
// Facility:	Microsoft Development Environment 2012  Version 11.0.50727.1
// Environment:	Microsoft .NET Framework 4.5            Version v4.0.30319
//
// Description: The CookieChipper about box
//
// Revision History:
// -Who--------------- -When---------- -What------------------------------------------------------
// Steven M. Cohn		18-Oct-2003		New
// Steven M. Cohn		20-Nov-2012		Refresh! VS2010 .NET 4.5 64-bit
//************************************************************************************************

namespace CookieChipper
{
	using System;
	using System.IO;
	using System.Reflection;
	using System.Windows.Forms;


	/// <summary>
	/// The CookieChipper about box
	/// </summary>

	internal partial class AboutBox : OptionalForm
	{

		public AboutBox ()
		{
			InitializeComponent();

			DateTime now = DateTime.Now;
			copyrightLabel.Text = copyrightLabel.Text.Replace("yyyy", now.Year.ToString());

			Assembly assembly = Assembly.GetEntryAssembly();
			Version version = assembly.GetName().Version;
			versionLabel.Text = versionLabel.Text.Replace("vvvv",
				version.Major + "." + version.Minor + "." + version.Build);

			var path = Path.Combine(Application.StartupPath, "History.txt");
			if (File.Exists(path))
			{
				using (var reader = File.OpenText(path))
				{
					historyBox.Text = reader.ReadToEnd();
					historyBox.Select(0, 0);
				}
			}
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>

		private void DoVisitHomePage (object sender, LinkLabelLinkClickedEventArgs e)
		{
			try
			{
				System.Diagnostics.Process.Start(webLink.Text);
			}
			catch (Exception exc)
			{
				MessageBox.Show(
					exc.Message, "Error",
					MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
		}
	}
}
